package com.example.withroadlogistics.Adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.example.withroadlogistics.R;
import com.example.withroadlogistics.model.TEnter;

import java.util.List;

/**
 * 司机还车记录查询适配器
 */
public class Adapter_Enter extends BaseAdapter {
    private Context context;
    private List<TEnter> list;

    //布局加载器
    private LayoutInflater inflater;

    public Adapter_Enter(Context context, List<TEnter> list) {
        this.context = context;
        this.list = list;
        //获取系统服务
        inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int i) {
        return list.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {

        view=inflater.inflate(R.layout.enterquery_item,null);


        TextView tv1=view.findViewById(R.id.userId);
        TextView tv2=view.findViewById(R.id.taskId);
        TextView tv3=view.findViewById(R.id.carId);
        TextView tv4=view.findViewById(R.id.enTime);
        TextView tv5=view.findViewById(R.id.enAddress);
        TextView tv6=view.findViewById(R.id.enContent);

        tv1.setText(list.get(i).getUserId()+"");
        tv2.setText(list.get(i).getTaskId()+"");
        tv3.setText(list.get(i).getCarId()+"");
        tv4.setText(list.get(i).getEnTime()+"");
        tv5.setText(list.get(i).getEnAddress()+"");
        tv6.setText(list.get(i).getEnContent()+"");

        return view;
    }
}
